package com.itheima.hw.test1;

import java.util.concurrent.*;

public class Test {

    public static void main(String[] args) {
        MyRunnable r = new MyRunnable();

        //new Thread(r,"小红").start();
        //new Thread(r,"小明").start();

        //1.创建线程池对象
        ExecutorService pool = new ThreadPoolExecutor(
                2,
                5,
                1000,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(3),
                new ThreadPoolExecutor.DiscardOldestPolicy()
        );


        //2.执行两个任务
        pool.execute(r);
        pool.execute(r);

    }
}
